package main.newViz;

import framework.Person;
import framework.PersonsFactory;
import impl.business.MatrixBiz;
import impl.game.grid.GridGame;
import impl.game.grid.GridRenderer;

import javax.swing.*;
import java.awt.*;
import java.util.Random;

/**
 * Date: 14.05.2008
 * Time: 19:14:41
 *
 * @author Denis DIR Rozhnev
 */
public class NewViz extends JPanel {
    private final MyTabbedPane tabbedPane;
    private final Runner runner;

    private final Config config = new Config();

    public NewViz() {
        super(new BorderLayout());
        runner = new Runner(config);

        tabbedPane = new MyTabbedPane(runner, config);
        add(tabbedPane);
        config.setup(createConfig());
    }

    private static Config createConfig() {
        //todo temporary
        GridGame game = new GridGame(8, 8, GridGame.Q4);
        MatrixBiz biz = new MatrixBiz(10, 8, 3, 0);
        Person[] players = new Person[64];
        Random rnd = new Random();
        for (int i = 0; i < players.length; i++) {
            players[i] = PersonsFactory.getPerson(rnd.nextInt(PersonsFactory.STRATEGIES_COUNT));
        }
        game.init(players, biz);

        GridRenderer renderer = new GridRenderer(game, 50, 18);

        return new Config(game, renderer);
    }
}
